Insert the Calls to the External JS File and the Function mmLoadMenus
For the menus to work in the pages that will load into the content frame, you will need to insert two lines of code into each of the HTML files that you will load into the content frame as the visitor navigates the site. All HTML files that load in the content frame will need these two lines of code. If you followed the instructions in the TechNote for your version of Fireworks, you should have already performed this operation, but as you work with your site, you may need to load other pages into the content frame or make changes, so I've included these instructions here. You can automate this by using the snippets that are included with the downloadable files. Where you place these lines is important, because it will make it easy for you to always find these tags when you view HTML exported from Fireworks; also one of them affects where the menus appear in Internet Explorer on Macintosh.
Note:To reiterate, if you followed the steps in the TechNote for your version of Fireworks, you won't have to do this step unless you are adding pages to your site that you want to load into the content frame. To enable the menus to be positioned relative to the nav frame table, I've included a snippet that you can use with the sample document to make the menu alignment easy.
Use the following steps if you have not yet followed the steps in the TechNotes or if you need to add new content frame HTML files:
-
Open the downloaded site folder and locate the snippets folder. There are four snippets files:
- Call mm_menu.js.csn
- Call mmLoadMenus function.csn
- Find Object.csn
- flevShowFramedFWPopup function.csn
Depending on your OS, you'll want to copy them to your Snippets\JavaScript\readable MM functions folder. When you restart Dreamweaver, the snippet files will appear in the Snippets tab of the Code panel. If Dreamweaver is open when you copy the files, you will need to restart it for the snippets to appear in the Snippets panel. If you are using Dreamweaver 4 or Dreamweaver UltraDev 4, you can open the completed htm files, locate, copy, and paste the code as needed from the navigation.htm and content.htm files.
Figure 2. The Code Snippet tab.
In Code view, click just before the
</head>tag and then double-click the Call mm_menu.js snippet under the JavaScript > Readable MM functions folder in the Snippets panel. This inserts the following line:
just before the </head> tag as shown in the above image. If you are using Dreamweaver or UltraDev 4, you can type the tag or copy it from the navigation.htm file in the start_folder in the downloaded examples.
Click just after the
<body>tag and then double-click the CallmmLoadMenusfunction snippet in the JavaScript > Readable MM functions folder in the Snippets panel.
If you are using Dreamweaver or UltraDev 4, you can type the tag or copy it from the navigation.htm file in the start_folder in the downloaded examples.
- To work with a horizontally-centered navigation menu's table in the example
files, insert the snippet menu_objects, which inserts a 500 x 1 pixel centered
table into your document, and has named images that are referenced by the
Pop-up Menu code, enabling the menus to remain center aligned no matter what
the browser width. Insert this snippet immediately after the call
mmLoadMenusfunction snippet. After doing so, you will find that adjusting the location of the Pop-up Menus is much easier. - Save your file and close it. That's all you need to do!
With the JavaScript provided in this tutorial, you've learned the following procedures:
- How and where to change the mm_menu.js file to enable the menus to work in Netscape 4.x browser.
- How to change the mouse event calls to point to Marja's function and inserted
the function,
flevShowFramedFWMenu. - How to use snippets to insert the calls to the external JavaScript file and the mmLoadMenus function.
- How to put the
mmLoadMenusfunction into the external JavaScript file. - How to enable all of the pages that you will load into the content frame to call the menus and display them in the browser.
Once you've completed these operations, save all of the files you have open and then select the frameset HTML in the Site panel and preview the page in a Browser. Unless you have live data on your pages in the Frameset, you can navigate, scroll, and navigate again without any difficulty—a most gratifying experience.
Click the Next to view additional information on Pop-up Menus and to read related articles and TechNotes.